<template>
	<view>
		<view>
			工单待办
		</view>
		<view>
			<uni-forms ref="form" :modelValue="formData" :rules="rules">
				<uni-forms-item label="想法" name="idea">
					<uni-easyinput v-model="formData.idea" placeholder="输入想法"></uni-easyinput>
				</uni-forms-item>
				<uni-forms-item label="建议" name="advice">
					<uni-easyinput v-model="formData.advice" placeholder="输入建议"></uni-easyinput>
				</uni-forms-item>
			</uni-forms>
		</view>
		<view>
			<button @click="submit">提交</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				formData: {
					idea: '',
					advice: ''
				},
				rules: {
					idea: {
						rules: [{
								required: true,
								errorMessage: '请输入想法',
							}
							// {
							// 	minLength: 3,
							// 	maxLength: 5,
							// 	errorMessage: '姓名长度在 {minLength} 到 {maxLength} 个字符',
							// }
						]
					},
					advice: {
						rules: [{
							// format: 'email',
							required: true,
							errorMessage: '请输入建议',
						}]
					}
				}
			}
		},
		methods: {
			submit() {
				this.$refs.form.validate().then(res => {
					console.log('表单数据信息：', res);
				}).catch(err => {
					console.log('表单错误信息：', err);
				})
				
				// GET请求示例
				uni.request({
				    url: '${this.$baseUrl}/dev-api/flowable/task/todoList', // 你的API接口地址
				    method: 'GET',
				    success: (res) => {
				        console.log('GET请求成功：', res.data);
				    },
				    fail: (err) => {
				        console.error('GET请求失败：', err);
				    }
				});
				
			}
		}
	}
</script>

<style>

</style>